package com.csun.cmny.provider.device.watch.entity;


    /// <summary>
    ///  下行闹钟配置包
    ///  关联上行确认 047
    /// Downside alarm clock configuration package
    /// Associative Upstream Confirmation 047
    /// </summary>
    public class C046
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol = null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "046";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI = null;

        /// <summary>
        ///  举例：0&1&0830&1111111%1&1&1630&1111100
        ///  闹钟类型[0：吃药提醒 1：喝水提醒 2：运动提醒 3：自定义 1]&闹钟开关[0 为关, 1 为开]&闹钟时间&重复规律[1111100，表示周一到周五工作，周六 / 周日不工作] 
        ///  多组闹钟用 % 分隔
        /// </summary>
        public String Ring = null;
        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime = null;
        /// <summary>
        /// 任务标识，用户自定义，方便回传标识
        /// Task identity, user custom, convenient return identification
        /// </summary>
        public String TaskId = null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";



        /// <summary>
        /// 初始化模型
        /// @B#@|01|046|111112222233333|0&1&0830&1111111%1&1&1630&11 11100|
        /// 20160715153805|0255BB90395C475E9D6155AF98B383875|@E#@
        /// </summary>
        /// <param name="cmdStr">命令代码</param>
        public C046(String cmdStr)
        {
        	String[] data = cmdStr.split("\\|");
            int dataLength = data.length;
            if (dataLength == 8 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                Ring = data[4];
                TerminalTime = data[5];
                TaskId = data[6];
                FootCode = data[7];
            }

        }

        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += Ring + "|";
            rString += TerminalTime + "|";
            rString += TaskId + "|";
            rString += FootCode;
            return rString;
        }
    }



